home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Dialog;
- import java.awt.Event;
- import java.awt.Frame;
- import java.awt.Label;
- import java.awt.LayoutManager;
- import java.awt.Rectangle;
-
- public class AboutDialog extends Dialog {
- Label label1;
- Button doneButton;
-
- void doneButton_Clicked(Event event) {
- ((Component)this).hide();
- }
-
- public AboutDialog(Frame parent, boolean modal) {
- super(parent, modal);
- ((Container)this).setLayout((LayoutManager)null);
- ((Dialog)this).addNotify();
- ((Component)this).resize(((Container)this).insets().left + ((Container)this).insets().right + 327, ((Container)this).insets().top + ((Container)this).insets().bottom + 91);
- this.label1 = new Label("A basic Java application");
- this.label1.reshape(((Container)this).insets().left + 26, ((Container)this).insets().top + 33, 181, 19);
- ((Container)this).add(this.label1);
- this.doneButton = new Button("Done");
- this.doneButton.reshape(((Container)this).insets().left + 233, ((Container)this).insets().top + 16, 60, 40);
- ((Container)this).add(this.doneButton);
- ((Dialog)this).setResizable(false);
- }
-
- public AboutDialog(Frame parent, String title, boolean modal) {
- this(parent, modal);
- ((Dialog)this).setTitle(title);
- }
-
- public synchronized void show() {
- Rectangle bounds = ((Component)this).getParent().bounds();
- Rectangle abounds = ((Component)this).bounds();
- ((Component)this).move(bounds.x + (bounds.width - abounds.width) / 2, bounds.y + (bounds.height - abounds.height) / 2);
- super.show();
- }
-
- public boolean handleEvent(Event event) {
- if (event.id == 201) {
- ((Component)this).hide();
- return true;
- } else {
- if (event.target == this.doneButton && event.id == 1001) {
- this.doneButton_Clicked(event);
- }
-
- return super.handleEvent(event);
- }
- }
- }
-